package com.hibase.core.excel.vo;

import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Map;

/**
 * TODO:
 *
 * @author <a href="mailto:xiongliyi@hichain.com">Ian Xiong</a>
 * @since 1.4.35-V2
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ErrorMessage {
    /**
     * 行索引
     */
    private Integer rowNum;

    /**
     * 当前行的数据JSON
     */
    private String rowDataJson;

    /**
     * 错误信息
     * <p/>
     * remark
     * <p/>
     * key:列名
     * value: 错误详情
     */
    private Map<String, String> errors = Maps.newHashMap();


    public ErrorMessage(Integer rowNum, String colNum, String errorMessage) {
        this.rowNum = rowNum;
        errors.put(colNum, errorMessage);
    }

    public ErrorMessage(Integer rowNum, Map<String, String> errors) {
        this.rowNum = rowNum;
        this.errors = errors;
    }

}
